package org.skipper.oss;

import com.aliyun.oss.ClientException;
import com.aliyun.oss.model.AsyncProcessObjectResult;
import com.aliyun.oss.model.PutObjectResult;
import org.skipper.oss.result.PutSignatureForWXResult;

import java.io.InputStream;
import java.net.URL;
import java.util.Date;


/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author shoujian
 * Date: 2024-03-07
 * Time: 16:25
 */
public interface OssClient {

    /**
     * 上传阿里云
     *
     * @param filePath 文件路径
     * @param input    输入
     * @return
     */
    PutObjectResult upload(String filePath, InputStream input);

    /**
     * 使用url上传
     *
     * @param filePath 文件路径
     * @param url      url
     * @return {@link PutObjectResult }
     */
    PutObjectResult uploadWithUrl(String filePath, String url);

    /**
     * 生成预签名url
     *
     * @param objectName 钥匙
     * @param expiration 到期
     * @return {@link URL}
     * @throws ClientException 客户端异常
     */
    URL generatePresignedUrl(String objectName, Date expiration) throws ClientException;

    /**
     * 首帧快照
     *
     * @param videoUrl 视频url
     * @return {@link AsyncProcessObjectResult}
     */
    URL snapshotFirstFrame(String videoUrl);

    /**
     * 按时间进行截帧
     *
     * @param time     时间 ms
     * @param videoUrl 视频url
     * @return {@link AsyncProcessObjectResult}
     */
    URL snapshotFrameByTime(Long time, String videoUrl);

    /**
     * 获取oss实际put签名
     *
     * @return {@link URL }
     */
    PutSignatureForWXResult getOssActualPutSignatureForWX();


}
